<template>
  <div id="name">
    <div class="wl-body">
      <div class="top"></div>
      <div class="topbox slideOut">
        <div class="bdds">
          <div class="txtsde txtc t-left">{{ $t("m.sfjl") }}</div>
          <div class="link-item">
            <div class="zc-dj t-left">TROT</div>
            <div class="slink defcf">
              <div class="flex1">{{ $t("m.jsrf") }}</div>
              <div class="flex1">{{ $t("m.ljsf") }}</div>
            </div>
            <div class="slink u-dj">
              <div class="flex1">
                {{ see ? (jrsf ? jrsf.toFixed(4) : "0") : "*****" }}
              </div>
              <div class="flex1">
                {{ see ? (s ? s.releaseTotal.toFixed(4) : "0") : "*****" }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div>
        <div class="i-title t-left mtp">— {{ $t("m.jllb") }} —</div>
      </div>

      <div class="bdds slideIn">
        <van-list
          v-model="loading"
          :finished="finished"
          :finished-text="$t('m.nomore')"
          @load="onLoad"
        >
          <div class="link-item bottml" v-for="(item, k) in sfxsdata" :key="k">
            <div class="slink defcf">
              <div class="flex1">{{ $t("m.sl") }}(TROT)</div>
              <div class="flex1">{{ $t("m.zt") }}</div>
              <div class="flex1">{{ $t("m.sj") }}</div>
            </div>

            <div class="slink u-dj">
              <div class="flex1">{{ item.releaseNum.toFixed(4) }}</div>
              <div class="flex1">{{ $t("m.ywc") }}</div>
              <div class="flex1">{{ item.createDate }}</div>
            </div>
          </div>
        </van-list>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "name",
  data() {
    return {
      isPublish: false,
      acchange: 0,
      jrsf: 0,
      loading: false,

      s: "",
      see: "",
      finished: false,
      pageNum: 1,
      sfxsdata: [],
    };
  },
  created() {
    this.s = JSON.parse(sessionStorage.getItem("s"));
    if (this.$store.getters.see == "0") {
      this.see = false;
    } else {
      this.see = true;
    }
  },
  methods: {
    guanbi() {
      this.$router.go(-1);
    },
    changers(val) {
      this.acchange = val;
    },
    onLoad() {
      if(this.$store.getters.nameid){
      var datas = {
        params: {
          uid: this.$store.getters.nameid,
          pageSize: 10,
          pageNum: this.pageNum,
          type: 1,
        },
      };
      this.$get({
        url: "wms-wallet-release/getList",
        data: datas,
        callback: (data) => {
          this.$nextTick(function () {
            var list = data.data;
            if (list) {
              if (this.pageNum == 1&&list.length>0) {
                this.jrsf = list[0].releaseNum;
              }
              if (this.pageNum > 1) {
                this.sfxsdata = [...this.sfxsdata, ...list];
              } else {
                this.sfxsdata = list;
              }
              this.loading = false;
              if (list.length != 0) {
                this.pageNum++;
              } else {
                this.finished = true;
              }
            } else {
              this.$toast(data.msg);
            }
          });
        },
      }).catch(() => {
        this.$toast(this.$i18n.t("m.errordata"));
      });
    }else{
        this.getuid()
    }},
           getuid() {
      this.$get({
        url: "wms-wallet/user-game-info/" + this.$store.getters.userWallet,
        data: {},
        callback: (data) => {
          this.$nextTick(function () {
            if (data.data) {
              this.$store.commit("nameid", data.data.id);
              this.onLoad();
            }
          });
        },
      }).catch(() => {
        this.$toast(this.$i18n.t("m.errordata"));
      });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>